package com.sxran.im.handler;

import com.sxran.im.bean.GenerateConversationIdReqBody;
import com.sxran.im.info.ImChatBody;
import com.sxran.im.info.ImConversation;
import com.sxran.im.service.ConversationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
@Slf4j
@Service
public class GenerateConversationCmdHandler  extends AbstractCmdHandler<GenerateConversationIdReqBody>{
    @Resource
    private ConversationService conversationService;

    @Override
    public Object doBeanService(GenerateConversationIdReqBody bean) {
        String conversation = bean.getConversation();
        ImConversation newConversationObj = new ImConversation();
        newConversationObj.setId(conversation);
        conversationService.fillConversation(bean.getChatType(),bean.getOriginalTo(),newConversationObj);
        //
        return newConversationObj;
    }
}
